<?php
class ModelLocalisationdistrict extends Model {
	public function getdistrict($district_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "district WHERE district_id = '" . (int)$district_id . "' AND status = '1'");
		
		return $query->row;
	}		
	
	public function getdistrictsByZoneId($zone_id) {
		$district_data = $this->cache->get('district.' . (int)$zone_id);
	
		if (!$district_data) {
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "district WHERE zone_id = '" . (int)$zone_id . "' AND status = '1' ORDER BY name");
	
			$district_data = $query->rows;
			
			$this->cache->set('district.' . (int)$zone_id, $district_data);
		}
	
		return $district_data;
	}
}
?>